package com.itaming.lycheeframework.support.cipher.asymmetric;

import com.itaming.lycheeframework.support.cipher.CipherAlgorithm;
import com.itaming.lycheeframework.support.cipher.Encryptor;
import org.springframework.util.Assert;

/**
 * 非对称加密器选项
 *
 * @param cipherAlgorithm 加密算法
 * @param publicKey       公钥
 * @param privateKey      私钥
 * @author A.Ming
 */
public record AsymmetricEncryptorOptions(CipherAlgorithm cipherAlgorithm,
                                         byte[] publicKey,
                                         byte[] privateKey) implements Encryptor.Options {

    /**
     * 构造函数
     *
     * @param cipherAlgorithm 加密算法
     * @param publicKey       公钥
     * @param privateKey      私钥
     */
    public AsymmetricEncryptorOptions {
        Assert.notNull(cipherAlgorithm, "cipherAlgorithm must not be null");

    }

    /**
     * 获取完整算法名称
     *
     * @return 完整算法名称
     */
    @Override
    public String getFullAlgorithm() {
        return cipherAlgorithm.getFullAlgorithm();
    }

}
